/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package projet_maths_svn;

import java.util.*;

/**
 *
 * @author Jean-Roch
 */
public class Solution {
    List<Token> resultat;
    Token lucky;
    
    
    public Solution(int a , int b , int c , int d , int e , int z)
    {
        resultat = new LinkedList<>();
        resultat.add(new Token(a,0));
        resultat.add(new Token(b,0));
        resultat.add(new Token(c,0));
        resultat.add(new Token(d,0));
        resultat.add(new Token(e,0));
        lucky = new Token(z,0);
    }
    
    public Solution(List<Token> aList, Token aLucky)
    {
        resultat = aList;
        lucky = aLucky;
    }
    
    public boolean Has(int i)
    {
        for (Token t : resultat)
        {
            if (t.equals(i))
            {
                return true;
            }
        }
        return false;
    }
    
    public boolean Has(Token t)
    {
        return Has(t.number);
    }
    
    public boolean HasLucky(Token t)
    {
        return HasLucky(t.number);
    }
    
    public boolean HasLucky(int i)
    {
        return lucky.equals(i);
    }
    
    public String ToString()
    {
        String tmp = "";
        for (Token t : resultat)
        {
            tmp += "[" + String.format("%02d",t.number) + "]";
        }
        tmp += "*" + String.format("%02d",lucky.number) + "*";
        return tmp;
    }
    
    /*
    public int NbCommon(List<Integer> aList)
    {
        int cnt = 0;
        for (Integer i : aList)
        {
            if (HasInt(i))
            {
                cnt++;
            }
        }
        return cnt;
    }*/
}
